<!--#include file="../nav/admin_top.php" --> 
<script type="text/javascript">
var url_save = '<?=url::build('admin_deliver','modify',array('reqtype'=>'json'))?>'; 
var url_return = '<?=url::build('admin_deliver','index')?>'; 
$().ready(function(){  
	showLoading();  

}); 
/* 保存 */
function fnSave(){ 
	var form = serializeObj("#myform");
	
	
	if(form.name == ''){
		alert('请填写【配送方式】');
		$('#name').focus();
		return false;
	}
	if(form.weight_first == '' || !fnRegExp('reg_int1',form.weight_first)){
		alert('请正确填写【首重重量】');
		$('#weight_first').focus();
		return false;
	}
	if(form.weight_xu == '' || !fnRegExp('reg_int1',form.weight_xu)){
		alert('请正确填写【续重重量】');
		$('#weight_xu').focus();
		return false;
	}
	if(form.weight_xu <= 0){
		alert('请正确填写【续重重量】');
		$('#weight_xu').focus();
		return false;
	}
	
	
	if(form.price_first == '' || !fnRegExp('reg_num1',form.price_first)){
		alert('请正确填写【首重运费】');
		$('#price_first').focus();
		return false;
	}
	if(form.price_xu == '' || !fnRegExp('reg_num1',form.price_xu)){
		alert('请正确填写【续重运费】');
		$('#price_xu').focus();
		return false;
	} 

	if(form.wfree_val == '' || !fnRegExp('reg_int1',form.wfree_val)){
		alert('请正确填写【免运费重量】');
		$('#wfree_val').focus();
		return false;
	} 
	if(form.mfree_val == '' || !fnRegExp('reg_num1',form.mfree_val)){
		alert('请正确填写【免运费金额】');
		$('#mfree_val').focus();
		return false;
	} 
	
  $('button').attr('disabled','disabled');
	$.ajax({
		async:true,
		type:'post',
		url:url_save,
		data:{
			form:JSON.encode(form)
		},
		success:function(e){
  		$('button').attr('disabled','');
			var ok = errorHandler(e);
			if(ok){　 
				jumpTo(url_return);
			}
		}
	});
}
</script>
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">配送方式 - 修改</span>
		<span class="totalSpan"> <label id="captionNum"></label> </span>
	</div>
</div> 
<div  class="button_div">
		<button class="btn_save" onclick="fnSave()">保 存</button>
		<span class="gray">或</span> 
		<button class=" " onclick="jumpTo(url_return);return false;">返 回</button>
</div>  
<form id="myform" action="" method="post" onsubmit="return false" >
<div class="blockdiv">
	<div class="titlediv">基本信息</div>
	<table class="mytable" >
		<tr>
			<td class="mylabel"><span class="red">*</span>配送方式：</td>
			<td class="myinfo" >
				<input type="hidden" id="id" name="id" value="{$rs.id}" />
				<input type="text" class="textBox" id="name" name="name" value="{$rs.name}" maxlength="50" style="width:80%" />
			</td>  
		</tr> 
		<tr>
			<td class="mylabel">配送方式说明：</td>
			<td class="myinfo" >
				<textarea class="textBox" style="height:90px;width:80%" id="remark" name="remark" >{$rs.remark}</textarea>
			</td>  
		</tr>
		<tr>
			<td class="mylabel">状态：</td>
			<td class="myinfo" >
				<label class="green">
					<input type="radio" name="status" value="1" <?php if($rs['status'] == '1') echo 'checked="checked"';?> />
					启用
				</label>
				<label class="red">
					<input type="radio" name="status" value="0" <?php if($rs['status'] == '0') echo 'checked="checked"';?>  />
					暂停
				</label>
			</td>  
		</tr>
	</table> 
</div> 
<div class="blockdiv">
	<div class="titlediv">运费</div>
	<table class="mytable" >
		<tr>
			<td class="mylabel"><span class="red">*</span>首重重量：</td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="weight_first" name="weight_first" maxlength="50" style="text-align:right" value="{$rs.weight_first}" /> 份
			</td>  
			<td class="mylabel"><span class="red">*</span>续重重量：</td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="weight_xu" name="weight_xu" maxlength="50" style="text-align:right"  value="{$rs.weight_xu}" /> 份
			</td>  
		</tr> 
		<tr>
			<td class="mylabel"><span class="red">*</span>首重运费：</td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="price_first" name="price_first" maxlength="50" style="text-align:right"  value="{$rs.price_first}" /> 元
			</td>  
			<td class="mylabel"><span class="red">*</span>续重运费：</td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="price_xu" name="price_xu" maxlength="50" style="text-align:right" value="{$rs.price_xu}"  /> 元
			</td>  
		</tr> 
	</table> 
</div> 
 
<div class="blockdiv">
	<div class="titlediv">免运费规则</div>
	<table class="mytable" >
		<tr>
			<td class="mylabel">免运费重量规则：</td>
			<td class="myinfo" >
				<label class="green">
					<input type="radio" name="wfree_flag" value="1" <?php if($rs['wfree_flag'] == '1') echo 'checked="checked"';?>  />
					开启
				</label>
				<label class="red">
					<input type="radio" name="wfree_flag" value="0"  <?php if($rs['wfree_flag'] == '0') echo 'checked="checked"';?> />
					暂停
				</label>
			</td>  
			<td class="mylabel"><div class="">免运费重量：</div></td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="wfree_val" name="wfree_val" maxlength="50" style="text-align:right" value="{$rs.wfree_val}"  /> 份
			</td>  
		</tr> 
		<tr>
			<td class="mylabel">免运费金额规则：</td>
			<td class="myinfo" >
				<label class="green">
					<input type="radio" name="mfree_flag" value="1" <?php if($rs['mfree_flag'] == '1') echo 'checked="checked"';?>  />
					开启
				</label>
				<label class="red">
					<input type="radio" name="mfree_flag" value="0"  <?php if($rs['mfree_flag'] == '0') echo 'checked="checked"';?>  />
					暂停
				</label>
			</td>  
			<td class="mylabel">免运费金额：</td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="mfree_val" name="mfree_val" maxlength="50" style="text-align:right" value="{$rs.mfree_val}"  /> 元
			</td>  
		</tr>
	</table> 
</div> 
  
</form>			
<div  class="button_div">
		<button class="btn_save" onclick="fnSave()">保 存</button>
		<span class="gray">或</span> 
		<button class=" " onclick="jumpTo(url_return);return false;">返 回</button>
</div>  
<!--#include file="../nav/admin_bottom.php" -->